package edu.online.dal;

import edu.online.entity.TimeItemEntity;
import org.apache.ibatis.jdbc.SQL;

public class TimeItemEntitySqlProvider {

    public String insertSelective(TimeItemEntity record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("timeitem");
        
        if (record.getTimeitemid() != null) {
            sql.VALUES("TimeItemID", "#{timeitemid,jdbcType=CHAR}");
        }
        
        if (record.getWeekday() != null) {
            sql.VALUES("WeekDay", "#{weekday,jdbcType=SMALLINT}");
        }
        
        if (record.getLessontime() != null) {
            sql.VALUES("LessonTime", "#{lessontime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(TimeItemEntity record) {
        SQL sql = new SQL();
        sql.UPDATE("timeitem");
        
        if (record.getWeekday() != null) {
            sql.SET("WeekDay = #{weekday,jdbcType=SMALLINT}");
        }
        
        if (record.getLessontime() != null) {
            sql.SET("LessonTime = #{lessontime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("TimeItemID = #{timeitemid,jdbcType=CHAR}");
        
        return sql.toString();
    }
}